package com.atguigu.gmall.user.service.impl;

import com.atguigu.gmall.cart.entity.UserAuth;
import com.atguigu.gmall.common.config.interceptor.component.UserAuthComponent;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.gmall.model.user.entity.UserAddress;
import com.atguigu.gmall.user.service.UserAddressService;
import com.atguigu.gmall.user.mapper.UserAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @author lyd
 * @description 针对表【user_address(用户地址表)】的数据库操作Service实现
 * @createDate 2025-03-21 20:19:52
 */
@Service
public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress>
        implements UserAddressService {

    @Autowired
    private UserAuthComponent userAuthComponent;

    @Override
    public List<UserAddress> getAddressList() {
        UserAuth userAuth = userAuthComponent.getUserAuth();
        return this.lambdaQuery()
                .eq(UserAddress::getUserId, userAuth.getUserId())
                .list();
    }
}




